/*
 * editTemplate.java
 *
 * Created on 4 de julio de 2008, 9:35
 */
package jule;

import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author  Administrador
 */
public class editTemplate extends javax.swing.JDialog {

    public String fileSelected;

    /**
     * Get the value of fileSelected
     *
     * @return the value of fileSelected
     */
    public String getFileSelected() {
        return fileSelected;
    }

    /**
     * Set the value of fileSelected
     *
     * @param fileSelected new value of fileSelected
     */
    public void setFileSelected(String fileSelected) {
        this.fileSelected = fileSelected;
    }

    public void fillText() {
        try {
            String fileName = getFileSelected().trim();
            File file = new File(fileName);
            String absolutePath = file.getAbsolutePath();
            String url = "file:///" + absolutePath;

            editor.setPage(url);
        } catch (IOException ex) {
            Logger.getLogger(editTemplate.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /** Creates new form editTemplate */
    public editTemplate(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();


    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        editor = new javax.swing.JEditorPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setName("Form"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        editor.setName("editor"); // NOI18N
        jScrollPane1.setViewportView(editor);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 352, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(27, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(43, 43, 43)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(27, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                editTemplate dialog = new editTemplate(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JEditorPane editor;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables

}
